<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<html>
<head>
<!-- Copyright 1997 The Open Group, All Rights Reserved -->
<title>getc_unlocked</title>
</head><body bgcolor=white>
<center>
<font size=2>
The Single UNIX &reg; Specification, Version 2<br>
Copyright &copy; 1997 The Open Group

</font></center><hr size=2 noshade>
<h4><a name = "tag_000_005_470">&nbsp;</a>NAME</h4><blockquote>
getc_unlocked, getchar_unlocked, putc_unlocked, putchar_unlocked
- stdio with explicit client locking
</blockquote><h4><a name = "tag_000_005_471">&nbsp;</a>SYNOPSIS</h4><blockquote>
<pre><code>

#include &lt;<a href="stdio.h.html">stdio.h</a>&gt;

int getc_unlocked(FILE *<i>stream</i>);
int getchar_unlocked(void);
int putc_unlocked(int <i>c</i>, FILE *<i>stream</i>);
int putchar_unlocked(int <i>c</i>);
</code>
</pre>
</blockquote><h4><a name = "tag_000_005_472">&nbsp;</a>DESCRIPTION</h4><blockquote>
Versions of the functions
<i><a href="getc.html">getc()</a></i>,
<i><a href="getchar.html">getchar()</a></i>,
<i><a href="putc.html">putc()</a></i>,
and
<i><a href="putchar.html">putchar()</a></i>
respectively named
<i>getc_unlocked()</i>,
<i>getchar_unlocked()</i>,
<i><a href="putc_unlocked.html">putc_unlocked()</a></i>,
and
<i><a href="putchar_unlocked.html">putchar_unlocked()</a></i>
are provided which are functionally identical to the original versions
with the exception that they are not required to be implemented
in a thread-safe manner.
They may only safely be used within a scope protected by
<i><a href="flockfile.html">flockfile()</a></i>
(or
<i><a href="ftrylockfile.html">ftrylockfile()</a></i>)
and
<i><a href="funlockfile.html">funlockfile()</a></i>.
These functions may safely be used in a multi-threaded program
if and only if they are called
while the invoking thread owns the (<b> FILE *</b>)
object, as is the case after a successful call of the
<i><a href="flockfile.html">flockfile()</a></i>
or
<i><a href="ftrylockfile.html">ftrylockfile()</a></i>
functions.
</blockquote><h4><a name = "tag_000_005_473">&nbsp;</a>RETURN VALUE</h4><blockquote>
See
<i><a href="getc.html">getc()</a></i>,
<i><a href="getchar.html">getchar()</a></i>,
<i><a href="putc.html">putc()</a></i>,
and
<i><a href="putchar.html">putchar()</a></i>.
</blockquote><h4><a name = "tag_000_005_474">&nbsp;</a>ERRORS</h4><blockquote>
No errors are defined. 
</blockquote><h4><a name = "tag_000_005_475">&nbsp;</a>EXAMPLES</h4><blockquote>
None.
</blockquote><h4><a name = "tag_000_005_476">&nbsp;</a>APPLICATION USAGE</h4><blockquote>
Because they may be implemented as macros, <i>getc_unlocked()</i>
and <i>putc_unlocked()</i> may treat incorrectly a stream argument
with side effects.
In particular,
<i>getc_unlocked</i>(*<i>f</i>++)
and
<i>putc_unlocked</i>(*<i>f</i>++)
will not necessarily work as expected.
Therefore, use of these functions should be preceded 
by the appropriate &quot;#undef getc_unlocked&quot; 
or &quot;#undef putc_unlocked&quot; statement
in such situations. 

</blockquote><h4><a name = "tag_000_005_477">&nbsp;</a>FUTURE DIRECTIONS</h4><blockquote>
None.
</blockquote><h4><a name = "tag_000_005_478">&nbsp;</a>SEE ALSO</h4><blockquote>
<i><a href="getc.html">getc()</a></i>,
<i><a href="getchar.html">getchar()</a></i>,
<i><a href="putc.html">putc()</a></i>,
<i><a href="putchar.html">putchar()</a></i>,
<i><a href="stdio.h.html">&lt;stdio.h&gt;</a></i>.
</blockquote><h4>DERIVATION</h4><blockquote>
Derived from the POSIX Threads Extension (1003.1c-1995)
</blockquote><hr size=2 noshade>
<center><font size=2>
UNIX &reg; is a registered Trademark of The Open Group.<br>
Copyright &copy; 1997 The Open Group
<br> [ <a href="../index.html">Main Index</a> | <a href="../xshix.html">XSH</a> | <a href="../xcuix.html">XCU</a> | <a href="../xbdix.html">XBD</a> | <a href="../cursesix.html">XCURSES</a> | <a href="../xnsix.html">XNS</a> ]

</font></center><hr size=2 noshade>
</body></html>

